<template>
  <el-form ref="adminForm" :model="form" :rules="rules" class="login-form">
    <el-form-item label="管理员账号" prop="username">
      <el-input v-model="form.username" placeholder="请输入管理员账号" />
    </el-form-item>
    <el-form-item label="密码" prop="password">
      <el-input v-model="form.password" type="password" placeholder="请输入密码" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="handleAdminLogin">管理员登录</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const form = ref({ username: '', password: '' });
const rules = {
  username: [{ required: true, message: '请输入管理员账号', trigger: 'blur' }],
  password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
};

const handleAdminLogin = () => {
  // 实际项目中需调用接口验证管理员身份
  router.push('/admin');
};
</script>

<style scoped>
.login-form {
  max-width: 300px;
  margin: 100px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
</style>